import { Text, View, Image, StyleSheet } from 'react-native'
import React, { Component } from 'react'
import { Cell, Popup } from '@pingtou/rn-vant'
import { asyncGetUserInfo } from "../../redux/features/appSlice"
import { connect } from 'react-redux'
import httpApi from "../../api"
import { pTx } from "../../utils/dimensions"



class MineSettings extends Component {
    render() {
        return (
            <View>
                <Cell.Group>
                    <Cell title="切换账号" center onPress={() => this.props.navigation.navigate('mineSwitchAccount')} value={<Image style={styles.Image} source={{ uri: httpApi.inline + this.props.app.userInfo.ProfilePhoto }}></Image>} />
                </Cell.Group>
                <Cell.Group>
                    <Cell title="加我为好友方式" center isLink onPress={() => this.props.navigation.navigate('setAdd')} value={['直接加', '', '需要验证', '', '禁止加'][this.props.app.userInfo.Status]} />
                </Cell.Group>
            </View>
        )
    }
}

const mapStateToProps = (state) => {
    return {
        Wallet: state.wallet.Wallet,
        app: state.app
    }
}

const mapDispatchToProps = {
    asyncGetUserInfo
}

export default connect(mapStateToProps, mapDispatchToProps)(MineSettings)

const styles = StyleSheet.create({
    Image: {
        width: pTx(40),
        height: pTx(40),
        borderRadius: pTx(6),
        backgroundColor: "#AFB5BD"
    },
})